package com.ln.adoms.entity;

import com.ln.core.orm.hibernate.BaseEntity;
import com.ln.core.security.entity.Users;

import javax.persistence.*;

/**
 * 部门相门设配置表
 * Created by xi on 14-5-20.
 */

@Entity
@Table(name = "depart_setting")
public class DepartSetting extends BaseEntity {


    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "user_id")
    private Users user; //设置配置的人员

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "department_id")
    private Department department; //部门

    private String config;  //配置内容

    @Enumerated(value = EnumType.STRING)
    private SETTING_TYPE type;//配置类型


    public String getConfig() {
        return config;
    }

    public void setConfig(String config) {
        this.config = config;
    }

    public Department getDepartment() {
        return department;
    }

    public void setDepartment(Department department) {
        this.department = department;
    }

    public SETTING_TYPE getType() {
        return type;
    }

    public void setType(SETTING_TYPE type) {
        this.type = type;
    }

    public Users getUser() {
        return user;
    }

    public void setUser(Users user) {
        this.user = user;
    }

    public static enum SETTING_TYPE {
        ORDER_AUTO_RECEIVE("订单自动确认收货设置", 1);

        SETTING_TYPE(String name, int code) {
            this.name = name;
            this.code = code;
        }

        private String name;
        private int code;

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }
    }
}
